home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.c
- Subject: Re: Basic Question on SWITCH
- Date: 29 Jan 1996 08:46:26 -0600
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4eimk2$eet@solutions.solon.com>
- References: <4e4cu4$95f@vixen.cso.uiuc.edu> <4eikud$e7b@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4eikud$e7b@solutions.solon.com>,
- Peter Seebach <seebs@solutions.solon.com> wrote:
- >main() {
- > int c, x, printf();
- > c = getchar();
- > switch (x = ((c = (unsigned char) c), /* try to ensure a legal char. */
- > ((!!isdigit(c)) << 1) | ((!!isalpha(c)) << 0)))
- > default:
- > printf(
- > (x == 0 ? "'\\x%x' is neither a letter nor a number.\n" :
- > (x == 1 ? "'%c' is a letter.\n" : (x == 2 ? "'%c' is a number.\n" :
- > (x == 3 ? "'%c' is both a letter and a number.\n" :
- > "'\\x%x' is odd.\n"))), c);
- Should be
- "'\\x%x' is odd.\n")))), c);
- of course.
-
- >As far as I can tell, this is legal and strictly conforming ANSI.
-
- Okay, I mean, *apart* from the typo.
-
- (Pretty good, though; in the entire life cycle of the program, it has had
- no bugs but typos that prevented compiles.)
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1995 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- Using trn? Weird new newsgroup problem? I know the fix! Email me!
- The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq - Not A Flying Toy
-